<?php
    
    
    namespace addons\zpwxsys\controller\v1;
    
    use addons\zpwxsys\controller\BaseController;
    use addons\zpwxsys\model\Sysmsg as SysmsgModel;
    use addons\zpwxsys\service\Token;
    
    class Sysmsg extends BaseController
    {
     
        public function getSysmsgList()
        {
            
            $uid = Token::getCurrentUid();
            
            $param['uid'] = $uid;
            
            $param['status'] = 1;
            
            $SysmsgModel = new SysmsgModel();
            
            $SysmsgModel->updateSysmsg($param);
            
            
            $od = "createtime desc";
    
            $Nowpage = input('post.page');
            if ($Nowpage) $Nowpage = $Nowpage; else
                $Nowpage = 1;
    
            $limits = $Nowpage * 20;
            $Nowpage = 1;
            
            $map['uid'] = $uid;
            $sysmsglist = $SysmsgModel->getSysmsgByWhere($map, $Nowpage, $limits, $od);
            
            $data = array('sysmsglist' => $sysmsglist);
            
            
            return json_encode($data);
            
            
        }
        
        public function updateSysmsg()
        {
            
            $uid = Token::getCurrentUid();
            
            $param['uid'] = $uid;
            
            $param['status'] = 1;
            
            $SysmsgModel = new SysmsgModel();
            
            $SysmsgModel->updateSysmsg($param);
            
            
            $data = array('status' => 0);
            
            
            return json_encode($data);
            
        }
        
    }